#include <stdio.h>
int main()
{
    int i = 0;
    int n = 0;
    int sum = 0;
    while (scanf("%d", &n) == 1)
    {
        for (i = 2; i <= 2 + 3 * (n - 1); i += 3)
        {
            sum += i;
        }
        printf("%d", sum);
        printf("\n");
    }
    return 0;
}